#include "TcpClient.h"
#include <memory>

using namespace std;
using namespace client;

static void usage(const string& process) {
    cout << "\nusage:\n\t" << process << " server_ip server_port\n" << endl;
}

//@usage ./TcpClient server_ip server_port
int main(int argc, char** argv) {
    if (argc != 3) {
        usage(argv[0]);
        exit(USAGE_ERR);
    }

    uint16_t server_port = (uint16_t)atoi(argv[2]);

    unique_ptr<TcpClient> tcp_client(new TcpClient(string(argv[1]), server_port));
    tcp_client->initClient();
    //* 客户端不需要变成守护进程，想退直接退就行
    tcp_client->start();

    return 0;
}